package bsc.ejb.metadata;

import bsc.ejb.entity.Comparator;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 *
 * @author memozac
 */
@Entity
public class Comparation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idComparation;

    @Column(columnDefinition="text")
    private String name;
    @Column(columnDefinition="text")
    private String description;

    public enum Type{REAL,GOAL,CUSTOM};

    @Enumerated
    private Type type;
    
    @OneToMany
    private List<Comparator> comparators;
    
    @ManyToOne
    private Framework framework;

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<Comparator> getComparators() {
        return comparators;
    }

    public void setComparators(List<Comparator> comparators) {
        this.comparators = comparators;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }
    
    public Framework getFramework() {
        return framework;
    }

    public void setFramework(Framework framework) {
        this.framework = framework;
    }

    public Long getIdComparation() {
        return idComparation;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idComparation != null ? idComparation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Comparation)) {
            return false;
        }
        Comparation other = (Comparation) object;
        if ((this.idComparation == null && other.idComparation != null) || (this.idComparation != null && !this.idComparation.equals(other.idComparation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bsc.ejb.entity.Comparator[id=" + idComparation + "]";
    }


    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

}//ends of class
